home *** CD-ROM | disk | FTP | other *** search
- @
- \mathchardef\RA="3221 % right arrow
- \mathchardef\BA="3224 % double arrow
- Here is a table of all the productions. Each production that
- combines two or more consecutive scraps implicitly inserts a {\tt \$}
- where necessary, that is, between scraps whose abutting boundaries
- have different |mathness|. In this way we never get double {\tt\$\$}.
-
- A translation is provided when the resulting scrap is not merely a
- juxtaposition of the scraps it comes from. An asterisk* next to a scrap
- means that its first identifier gets an underlined entry in the index,
- via the function |make_underlined|. Two asterisks** means that both
- |make_underlined| and |make_reserved| are called, that is, the
- identifier's ilk becomes |int_like|. We use |in|, |out|, |back| and
- |bsp| as shorthands for |indent|, |outdent|, |backup| and
- |break_space|, respectively.
-
- \def\tspan{\omit&&\omit\hfil\hskip-300pt}
- \def\alt #1 #2
- {$\displaystyle\Bigl\{\!\matrix{\hbox{#1}\cr\hbox{#2}\cr}\!\Bigr\}$ }
- \def\altt #1 #2 #3
- {$\displaystyle\Biggl\{\!\matrix{\hbox{#1}\cr\hbox{#2}\cr\hbox{#3}\cr}\!\Biggl\}$ }
- \def\malt #1 #2
- {$\displaystyle\matrix{\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr}$}
- \def\maltt #1 #2 #3
- {$\displaystyle\matrix{\hbox{#1}\hfill\cr\hbox{#2}\hfill\cr\hbox{#3}\hfill\cr}$}
- {
- \yskip\newcount\prodno\prodno=0\def\ignore#1{}
- \halign to\hsize{\hfil\it\global\advance\prodno by1 \number\prodno\ignore{#}\ &%
- #\hfil\tabskip 0pt plus 200pt&%
- $\RA$ #\hfil&$\quad$#\hfil\tabskip0pt\cr
- \omit & LHS & RHS \hfill Translation & Example\cr
- \noalign{\yskip}
- & |exp| \alt|lbrace| |int_like| & |fn_decl| \alt|lbrace| |int_like|
- \hfill $F=E^*$ & \malt {|main(){|} {|main(argc,argv)int argc;|} \cr
- & |exp| |unop| & |exp| & |x++|\cr
- & |exp| \alt |binop| |unorbinop| |exp| & |exp| & \malt {|x+y|} {|x*y|} \cr
- & |exp| |comma| |exp| & |exp| \hfill $E_1C\,|opt|9\,E_2$& |f(x,y)|\cr
- & |exp| |exp| & |exp| & |time()|\cr
- & |exp| |semi| & |stmt| & |x=0;|\cr
- & |exp| |colon| & |tag| \hfill $E^*C$ & |found:|\cr
- & |lpar| |exp| |rpar| & |exp| & |(x+y)|\cr
- & |lpar| |rpar| & |exp| \hfill $L\.{\\,}R$ & functions and declarations\cr
- & |lpar| \alt |decl_head| |int_like| |rpar| & |cast| \hfill
- $LDR$ & |(char*)|\cr
- & |lpar| |stmt| & |lpar| \hfill $LS\.\ $ & |for| constructions\cr
- & |question| |exp| |colon| & |binop| & |x==y?x+1:0|\cr
- & |unop| |exp| & |exp| & |*x|\cr
- & |unorbinop| |exp| & |exp| \hfill $\.\{U\.\}$ & |*x|\cr
- & |unorbinop| |binop| & |binop| \hfill $|math_bin|\,U\.\{B\.\}\.\}$ & |*=|\cr
- & |binop| |binop| & |binop| \hfill
- $B=|math_bin|\,B_1\.\{B_2\.\}\.\}$ & |x+=y|\cr
- & |cast| |exp| & |exp| \hfill $C\.\ E$ & |(double)x|\cr
- & |sizeof_like| |cast| & |exp| & |sizeof (double)|\cr
- & |sizeof_like| |exp| & |exp| \hfill $S\.\ E$ & |sizeof x|\cr
- & |int_like| \alt|int_like| |struct_like| &
- \alt|int_like| |struct_like| \hfill $I\.\ $\alt $I$ $S$
- \unskip& |extern char|\cr
- & |int_like| \alt|exp| |unorbinop| & |decl_head|
- \alt|exp| |unorbinop| \hfill $D=I\.\ $ & |int x|\cr
- & |decl_head| |comma| & |decl_head| \hfill $DC\.\ $ & |int x,y|\cr
- & |decl_head| |unorbinop| & |decl_head| \hfill $D\.\{U\.\}$ & |int *x|\cr
- & |decl_head| |exp| & |decl_head| \hfill $DE^*$ & |int x|\cr
- & |decl_head| \alt|binop| |colon| |exp| \alt|comma| |semi| &
- |decl_head| \alt|comma| |semi| \quad
- $D=D$\alt $B$ $C$ \unskip$E$ & \malt initialization fields \cr
- & |decl_head| \alt|int_like| |lbrace| & |fn_decl|
- \alt|int_like| |lbrace| & |long time () {|\cr
- & |decl_head| |semi| & |decl| & |int n;|\cr
- & |decl| |decl| & |decl| \hfill $D_1\,|force|\,D_2$ & |int n;double x;|\cr
- & |decl| \alt|stmt| |function| & \alt|stmt| |function|
- \hfill $D\,|big_force|\,$\alt $S$ $F$ \unskip& |extern n;main () {}|\cr
- & |typedef_like| |decl_head| |exp| & |typedef| |decl_head|
- \hfill $D=DE^{**}$ & |typedef char ASCII;|\cr
- & |typedef_like| |decl_head| |semi| & |decl| \hfill $T\.\ D$ &
- |typedef int x,y;|\cr
- & |struct_like| |lbrace| & |struct_head| \hfill $S\.\ L$ & |struct {|\cr
- & |struct_like| |exp| |lbrace| & |struct_head| \hfill $S\.\ E\.\ L$
- & |struct name_info {|\cr
- & |struct_like| |exp| & |int_like| \hfill $S\.\ E$ & |struct name_info z;|\cr
- & |struct_head| \alt|decl| |stmt| |rbrace| & |int_like|\cr
- \tspan $S\,|in|\,|force|\,D\,|out|\,|force|\,R$ &
- |struct {| declaration |}|;\cr
- & |fn_decl| |decl| & |fn_decl| \hfill $F\,|force|\,D$ & |f(z) double z;| \cr
- & |fn_decl| |stmt| & |function| \hfill $F\,|force|\,S$ & |main ()| {\dots}\cr
- & |function| \alt |decl| |function| & \alt |decl| |function| \hfill
- $F\,|big_force|\,$\alt $D$ $F$ & outer block\cr
- & |lbrace| |rbrace| & |stmt| \hfill $L\.{\\,}R$ & empty statement\cr
- & |lbrace| |stmt| |rbrace| & |stmt|\cr
- \tspan $|force|\,L\,|in|\,|force|\,S\,
- |force|\,|back|\,R\,|out|\,|force|$ & compound statement\cr
- & |lbrace| |exp| [|comma|] |rbrace| & |exp| & initializer\cr
- & |if_like| |exp| & |else_like| \hfill $I\.{\ }E$ & |if (z)|\cr
- & |else_like| |lbrace| & |if_head| |lbrace| & compound statement\cr
- & |else_like| |stmt| |else_like| & |else_like|\cr
- \tspan $|force|\,I\,|in|\,|bsp|\,S\,|out|\,|force|\,E\,|cancel|$ &
- |if|-|else| clause\cr
- & |else_like| |stmt| & |stmt|\cr
- \tspan $|force|\,I\,|in|\,|bsp|\,S\,|out|\,|force|$ &
- |else|-less |if|\cr
- & |if_head| |stmt| |else_like| & |else_like|\cr
- \tspan $|force|\,I\,|bsp|\,\.{\{\}}\,|cancel|\,S\,|bsp|\,E\,\.\ \,|cancel|$ &
- |if|-|else| clause\cr
- & |if_head| |stmt| & |stmt| \cr
- \tspan $|force|\,I\,|bsp|\,\.{\{\}}\,|cancel|\,S\,|force|$
- & |else|-less |if|\cr
- & |do_like| |stmt| |if_like| & |if_like| \hfill
- $D\,|bsp|\,S\,|bsp|\,I$ & |do| statements\cr
- & |case_like| |semi| & |stmt| & |return;|\cr
- & |case_like| |exp| |semi| & |stmt| \hfill $R\.\ ES$ & |return 0;|\cr
- & |case_like| |colon| & |tag| & |default:|\cr
- & |case_like| |exp| |colon| & |tag| \hfill $C\.\ EC$ & |case 0:|\cr
- & |tag| |tag| & |tag| \hfill $T_1\,|bsp|\,T_2$ & |case 0: case 1:|\cr
- & |tag| |stmt| & |stmt| \hfill
- $|force|\,|back|\,T\,|bsp|\,S$ & |case 0: z=0;|\cr
- & |stmt| |stmt| & |stmt| \hfill $S_1\,|bsp|\,S_2$ & compound statement\cr
- & |semi| & |stmt| & empty statement\cr
- & |lproc| \altt |if_like| |else_like| |define_like| & |lproc| &
- \maltt {{\bf \#ifdef, \#include, \#line}} {\bf\#else} {\bf\#define} \cr
- & |lproc| |rproc| & |lrproc| & {\bf\#endif} \cr
- & |lproc| |exp| [|exp|] |rproc| & |lrproc| \hfill $I\.\ E{[\.\ E]}$ &
- |ifdef,include,line|\cr
- }
- }
-